package cn.piesat.util.queue;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author zyp
 * @date 2021/3/15
 */
@Component
public class QueueListener {
    @Autowired
    private OrderTask orderTask;

    /**
     * 初始化时启动监听请求队列
     */
    @PostConstruct
    public void init(){
        orderTask.start();
    }
    /**
     * 销毁容器时停止监听任务
     */
    @PreDestroy
    public void destory(){
        orderTask.setRunning(false);
    }
}
